import { MathUitl } from "../../../../../com/gengine/utils/MathUitl";
import { ConfigManager } from "../../../../../com/gengine/resource/ConfigManager";
import { RolePlayerCopy } from "../player/RolePlayerCopy";
import { AStarPoint } from "../../../scene/map/AStarPoint";
import { SPoint } from "../../../../../Message/Public/SPoint";
import { LGXBMap } from "../map/LGXBMap";
import { LGXBDirection } from "../dir/LGXBDirection";
//class LGXBData
    
    export  class LGXBData
    {
        

        public getJsonObject(): Object
        {
            var loc1=null;
            var loc2=0;
            var loc3=null;
            var loc4=null;
            if (this.useDebugData) 
            {
                if (!this.objDic) 
                {
                    this.objDic = new Map<any, any> /* flash.utils.Dictionary */(false);
                    loc1 = ["0,0", "0,1", "0,2", "0,3", "0,4", "0,5", "0,6", "0,7", "0,8", "1,0", "1,5", "1,8", "2,0", "2,5", "2,8", "3,0", "3,1", "3,2", "3,3", "3,5", "3,6", "3,7", "3,8", "4,0", "4,3", "4,8", "5,0", "5,1", "5,2", "5,3", "5,4", "5,5", "5,6", "5,7", "5,8"];
                    loc2 = 0;
                    while (loc2 < loc1.length) 
                    {
                        loc3 = new Object();
                        loc4 = loc1[loc2];
                        loc3.code = loc2;
                        loc3.x = Number(loc4.charAt(0));
                        loc3.y = Number(loc4.charAt(2));
                        loc3.randEvent = MathUitl.random(1, 5);
                        this.objDic[loc2] = loc3;
                        ++loc2;
                    }
                }
                return this.objDic;
            }
            return ConfigManager.instance.getJSONByFileName("t_dragon.json");
        }

        public getPath(arg1: Array<any>, arg2: RolePlayerCopy): Array<any>
        {
            var loc1=0;
            var loc2=null;
            var loc3=0;
            var loc4=0;
            var loc5=0;
            var loc6=null;
            var loc7=0;
            var loc8=null;
            var loc9=0;
            var loc10=null;
            if (this.useDebugData) 
            {
                loc1 = arg1.length;
                loc2 = [];
                loc3 = arg2.curToDirect;
                loc4 = arg2.currentPoint.x;
                loc5 = arg2.currentPoint.y;
                loc6 = new AStarPoint(loc4, loc5);
                loc7 = 0;
                while (loc7 < loc1) 
                {
                    loc8 = new SPoint();
                    if ((loc9 = LGXBMap.instance.autoFindNextRoadPointDirect(loc3, loc6.x, loc6.y)) != LGXBDirection.toNone) 
                    {
                        loc3 = loc9;
                    }
                    else 
                    {
                        loc3 = (loc10 = LGXBMap.instance.getThreeRoadPoints(loc3, loc6.x, loc6.y))[MathUitl.random(0, 2)];
                    }
                    loc6 = LGXBMap.instance.pointingNextRoadPoint(loc3, loc6.x, loc6.y);
                    loc8.x = loc6.x;
                    loc8.y = loc6.y;
                    loc2.push(loc8);
                    ++loc7;
                }
                return loc2;
            }
            return arg1;
        }

        /* internal */ /* var */objDic: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */useDebugData: Boolean=false;

        public static /* var */instance: LGXBData;
    }

            LGXBData.instance = new LGXBData();
        